home *** CD-ROM | disk | FTP | other *** search
- Path: oxy.rust.net!usenet
- From: ebennett@rust.net
- Newsgroups: comp.lang.c++
- Subject: Re: BC45, using a function in another project.
- Date: Wed, 17 Jan 1996 05:58:18 GMT
- Organization: Rust Net - High Speed Internet in Detroit 810-642-2276
- Message-ID: <4dhoir$ioj@oxy.rust.net>
- References: <4dfa06$eui@newsserver.trl.OZ.AU>
- NNTP-Posting-Host: liv-10.rust.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- t.hand@trl.oz.au (Trevor Hand) wrote:
-
- >I am building a group of general functions which are
- >stored in a file called "MyUtils\GenUtil.cpp". How do I
- >declare each function so that they are available to another
- >file in another directory, ie. they have global access, so
- >they can be used by other projects. eg.
-
- >------------------------------
- >\MyUtils\GenUtil.cpp -
- >my collection of functions
-
- >int MyGeneralVariable;
-
- >void MyGeneralFunction(){
- > //Does something usefull
- > };
- >------------------------------
-
- >------------------------------
- >\Programs\MyApp.cpp
- >#include "GenUtil.h" //I have set Project/Options to include a
- >//path to MyUtils. A node to GenUtil.cpp is added to the IDE file.
- >:
- >:
- >MyGeneralFunction();//Linker says MyGeneralFunction is undefined
- >i = MyGeneralVariable;//I also want to use a variable from GenUtil.
- >:
-
- I do not see anything wrong with what has been described here. The
- only thing that I can think of is if the prototype for
- MyGeneralFunction() in GenUtil.h is not exactly identical to its
- declaration in GenUtil.cpp, the linker will not be able to match them
- up.
-
- Earl
-
-
-